﻿namespace Commander.Core.UIs.WinForms.Controls.Parts
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using Commander.Core.Interfaces.Bases;

    public partial class PanelItemControl : DataGridView
    {
        public PanelItemControl()
        {
            InitializeComponent();

            // load conf

            AllowUserToAddRows = false;
            AllowUserToDeleteRows = false;
            AllowUserToResizeRows = false;
            ClipboardCopyMode = DataGridViewClipboardCopyMode.Disable;            
            ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;            
            EditMode = DataGridViewEditMode.EditProgrammatically;                        
            RowHeadersVisible = false;
            RowTemplate.DefaultCellStyle.WrapMode = DataGridViewTriState.False;
            SelectionMode = DataGridViewSelectionMode.FullRowSelect;            
            StandardTab = true;
            TabIndex = 0;

            DataGridViewCellStyle headersDefaultCellStyl = new DataGridViewCellStyle();
            headersDefaultCellStyl.Alignment = DataGridViewContentAlignment.MiddleLeft;
            headersDefaultCellStyl.BackColor = SystemColors.Control;            
            headersDefaultCellStyl.ForeColor = SystemColors.WindowText;
            headersDefaultCellStyl.SelectionBackColor = SystemColors.Highlight;
            headersDefaultCellStyl.SelectionForeColor = SystemColors.HighlightText;
            headersDefaultCellStyl.WrapMode = DataGridViewTriState.False;
            ColumnHeadersDefaultCellStyle = headersDefaultCellStyl;

            AutoGenerateColumns = false;
            Columns.Clear();
            Columns.Add(new DataGridViewColumn()
            {
                DataPropertyName = "Name",
                HeaderText = "Name",
                AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill,
                CellTemplate = new DataGridViewTextBoxCell()
            });
        }

        protected override void OnKeyDown(KeyEventArgs e)
        {            
            if (e.KeyCode == Keys.Return)
            { }
            else
                base.OnKeyDown(e);
        }
    }
}
